<%--
  Created by IntelliJ IDEA.
  User: bb
  Date: 2021/10/14
  Time: 16:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" pageEncoding="UTF-8" %>
<html>
<head>
    <title>管理员登录页面</title>
    <link href="jquery-easyui-1.7.0/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="jquery-easyui-1.7.0/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="jquery-easyui-1.7.0/demo/demo.css" rel="stylesheet" type="text/css" />
    <script src="jquery-easyui-1.7.0/jquery.min.js" type="text/javascript"></script>
    <script src="jquery-easyui-1.7.0/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="jquery-easyui-1.7.0/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
</head>
<body style="background: url(bg.jpg)">
    <script type="text/javascript">
        function clearForm(){ //清空
            $('#adminLoginForm').form('clear');
        }
        function checkAdminLogin(){ //登录
            $("#adminLoginForm").form("submit", {
                //向控制器类AdminInfoController中的login方法发送请求
                url:'admin/login',
                success:function (result){
                    var result1 = eval('('+result+')');
                    if ( result1.success == "true" ){
                        window.location.href = 'admin.jsp';
                        $("#adminLoginDlg").dialog("close");
                    }else {
                        $.messager.show({
                            title:"提示信息",
                            msg:result1.message
                        })
                    }
                }
            })
        }
    </script>
    <div id="adminLoginDlg" class="easyui-dialog" style="left: 40%; top: 40%; width: 300px;height: 200px;"
         data-options="title:'后台登陆', buttons:'#bb', modal:true">
        <form id="adminLoginForm" method="post">
            <table style="margin: 20px; font-size: 13px;">
                <tr>
                    <th>用户名</th>
                    <td><input type="text" class="easyui-textbox" id="name"
                               name="name" data-options="required:true" value="admin"></td>
                </tr>
                <tr>
                    <th>密码</th>
                    <td><input type="password" class="easyui-textbox" id="pwd"
                               name="pwd" data-options="required:true" value="123456"></td>
                </tr>
            </table>
        </form>
    </div>
    <div id="bb">
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="checkAdminLogin()">登录</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">重置</a>
    </div>
</body>
</html>
